package com.example.handler;

import com.example.model.FraudRiskResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * 低风险处理器
 * 处理评分小于30的低风险案例
 * 
 * @author system
 */
@Component
@Order(3)
@RequiredArgsConstructor
@Slf4j
public class LowRiskHandler implements RiskHandler {

  @Override
  public boolean canHandle(FraudRiskResult result) {
    return result.getRiskLevel() == 0; // 低风险
  }

  @Override
  public void handle(FraudRiskResult result) {
    if (!canHandle(result)) {
      return;
    }

    log.info("处理低风险案例，用户地址：{}，风险评分：{}", result.getUserAddress(), result.getScore());

    // 低风险只记录日志，不采取实质性措施
    log.info("发现低风险行为，已记录但不采取措施，用户地址：{}", result.getUserAddress());
  }

  @Override
  public int getOrder() {
    return 3; // 低风险最后处理
  }
}